<?php
/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */


/**
 * Smarty status modifier plugin
 *
 * Type:     modifier<br>
 * Name:     time<br>
 * Purpose:  Substr a string to a certain length if necessary,
 *           optionally splitting in the middle of a word, and
 *           appending the $etc string or inserting $etc into the middle.
 * @link http://smarty.php.net/manual/en/language.modifier.time.php
 *          time (Smarty online manual)
 * @author   Monte Ohrt <monte at ohrt dot com>
 * @param string
 * @param integer
 * @param string
 * @param boolean
 * @param boolean
 * @return string
 */
//
function smarty_modifier_status($value, $type = '')
{
	if( $type == 'order' ) {
		$order_statuses = array(
					'10' => 'Unsubmitted', 
					'11' => 'Submitted', '12' => 'Processing', '13' => 'Pending', '14' => 'Confirmed', 
					'20' => 'Awaiting Payment', '21' => 'Payment Blocking', '22' => 'Over Credit Line', '23' => 'Payment Delay', 
					'24' => 'Ready to Shipped', 
					'25' => 'Paid', 
					'26' => 'Shipped', '28' => 'Delivered', '31' => 'Completed', 
					'32' => 'Failed', '33' => 'Canceled', '34' => 'Declined', '35' => 'Returned', '41' => 'BackOrdered',
						);
		
		if( isset($order_statuses[$value]) ) {
			return $order_statuses[$value];
		}
		return '';
	} elseif( $type == 'active' ) {
		if( $value == 1 ) {
			return 'Active';
		} elseif( $value == '0' ) {
			return 'Deactive';
		}
	} elseif( $type == 'oc' ) {
		if( $value == 1 ) {
			return 'Open';
		} elseif( $value == '0' ) {
			return 'Close';
		}
	} elseif( $type == 'user' ) {
		if( $value == 1 ) {
			return 'yes';
		} elseif( $value == '0' ) {
			return 'no';
		}
	} else {
		if( $value == 1 ) {
			return 'Y';
		} elseif( $value == '0' ) {
			return 'X';
		}
	}
}
//
?>